home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / tu32.zip / TU32DEMO / DLGPROJ / TESTUNIT.PAS < prev   
Pascal/Delphi Source File  |  1996-12-07  |  4KB  |  138 lines

  1. unit Testunit;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, TRepDlg, DB, DBTables;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     RepairDialog1: TRepairDialog;
  13.     GroupBox1: TGroupBox;
  14.     rdDBCombosEnabled: TCheckBox;
  15.     rdDBCombosVisible: TCheckBox;
  16.     rdCheckBoxEnabled: TCheckBox;
  17.     rdCheckBoxVisible: TCheckBox;
  18.     rdSourceListEnabled: TCheckBox;
  19.     rdSourceListVisible: TCheckBox;
  20.     rdSelectBtnsVisible: TCheckBox;
  21.     rdExceptListVisible: TCheckBox;
  22.     rdVerifyOnlyBtnVisible: TCheckBox;
  23.     rdViewErrosBtnVisible: TCheckBox;
  24.     rdVerRebBtnVisible: TCheckBox;
  25.     rdRebuildOnlyVisible: TCheckBox;
  26.     rdSaveBatchVisible: TCheckBox;
  27.     rdFileInfoVIsible: TCheckBox;
  28.     rdGuagesVisible: TCheckBox;
  29.     rdLogVisible: TCheckBox;
  30.     CheckBox1: TCheckBox;
  31.     Label1: TLabel;
  32.     Memo1: TMemo;
  33.     Memo2: TMemo;
  34.     CheckBox2: TCheckBox;
  35.     Label2: TLabel;
  36.     Label3: TLabel;
  37.     Button2: TButton;
  38.     procedure Button1Click(Sender: TObject);
  39.     procedure rdDBCombosEnabledClick(Sender: TObject);
  40.     procedure CheckBox1Click(Sender: TObject);
  41.     procedure FormCreate(Sender: TObject);
  42.     procedure CheckBox2Click(Sender: TObject);
  43.     procedure Button2Click(Sender: TObject);
  44.   private
  45.     { Private declarations }
  46.   public
  47.     { Public declarations }
  48.  
  49.   end;
  50.  
  51. var
  52.   Form1: TForm1;
  53.  
  54. implementation
  55.  
  56. {$R *.DFM}
  57.  
  58. procedure TForm1.Button1Click(Sender: TObject);
  59. begin
  60.   { First update the TableList property in the Dialog component to reflect any
  61.   changes the user made in the TMemo }
  62.   RepairDialog1.TableList.Clear;
  63.   RepairDialog1.TableList.AddStrings(Memo1.Lines);
  64.   {Now Execute the dialog }
  65.   RepairDialog1.Execute;
  66. end;
  67.  
  68. procedure TForm1.rdDBCombosEnabledClick(Sender: TObject);
  69. {Generally speaking I hate it when peoply write code like the following cause
  70.  its so cryptic. In this case I did it anyway cause it saves writing two
  71.  huge case statements.}
  72. begin
  73.   If TCheckBox(Sender).Checked then
  74.     RepairDialog1.DlgOptions :=
  75.       RepairDialog1.DlgOptions + [TRDOption(TCheckBox(Sender).Tag)]
  76.   else
  77.     RepairDialog1.DlgOptions :=
  78.       RepairDialog1.DlgOptions - [TRDOption(TCheckBox(Sender).Tag)];
  79. end;
  80.  
  81. procedure TForm1.CheckBox1Click(Sender: TObject);
  82. begin
  83.   if CheckBox1.Checked then
  84.     RepairDialog1.CallbackActive := True
  85.   else
  86.     RepairDialog1.CallBackActive := False;
  87. end;
  88.  
  89. procedure TForm1.CheckBox2Click(Sender: TObject);
  90. begin
  91.   if CheckBox2.Checked then
  92.     RepairDialog1.BorrowRebuildOnly := True
  93.   else
  94.     RepairDialog1.BorrowRebuildOnly := False;
  95. end;
  96.  
  97.  
  98. procedure TForm1.FormCreate(Sender: TObject);
  99. var
  100.  I : Integer;
  101. begin
  102.   { This For loop saves setting each checkbox individually for the
  103.     DlgOptions Property}
  104.   For I := 0 to GroupBox1.ControlCount - 1 do
  105.   begin
  106.     If GroupBox1.Controls[I] is TCheckBox then
  107.     begin
  108.       If TRDOption(I) in RepairDialog1.DlgOptions then
  109.         TCheckBox(GroupBox1.Controls[I]).Checked := True
  110.       else
  111.         TCheckBox(GroupBox1.Controls[I]).Checked := False;
  112.     end;
  113.   end;
  114.   { Set CheckBox1 acording to the CallBackActive Property}
  115.   If RepairDialog1.CallbackActive then
  116.     CheckBox1.Checked := True
  117.   else
  118.     CheckBox1.Checked := False;
  119.   { Set CheckBox2 acording to the BorrowRebuildOnly Property}
  120.   If RepairDialog1.BorrowRebuildOnly then
  121.     CheckBox2.Checked := True
  122.   else
  123.     CheckBox2.Checked := False;
  124.   {Show the list of tables in the TableList Property}
  125.    Memo1.Lines.Clear;
  126.    Memo1.Lines.AddStrings(RepairDialog1.TableList);
  127. end;
  128.  
  129.  
  130. procedure TForm1.Button2Click(Sender: TObject);
  131. begin
  132.   Close;
  133. end;
  134.  
  135. end.
  136.  
  137.  
  138.